package com.easidea.tim.entity.system.orgnization;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.springside.core.dao.extend.Undeletable;

import com.easidea.tim.entity.BaseEntity;
@Entity(name="tim_orgnization_staff_creditlimit")
@org.hibernate.annotations.Entity(dynamicInsert=true,dynamicUpdate=true)
@Cache(region="tim_orgnization_staff_creditlimit",usage=CacheConcurrencyStrategy.READ_WRITE)
@Undeletable(status="deleted")
public class StaffCreditLimit extends BaseEntity {
	
	public static final String CREDIT_LIMITATION_STAFF_CURRENT_VALUE = "current_staff_credit"; //员工当前信用
	public static final String CREDIT_LIMITATION_STAFF_CUSTOMER_VALUE = "current_staff_customer_credit"; //员工对应客户的信用额

	/**
	 * 
	 */
	private static final long serialVersionUID = -1285291262880383057L;
	private Staff staff;
	//初始额度
	private Double initCreditLimit;
	//修改前额度
	private Double preCreditLimit;
	//当前额度
	private Double currentCreditLimit;
	//修改额度时间
	private Date modifyLimitTime;
	//修改额度人
	private Long modifyLimitStaffId;
	
	@OneToOne(cascade = CascadeType.MERGE)
    @JoinColumn(name="staff_id")
	public Staff getStaff() {
		return staff;
	}
	public void setStaff(Staff staff) {
		this.staff = staff;
	}
	@Column(name="init_credit_limit")
	public Double getInitCreditLimit() {
		return initCreditLimit;
	}
	public void setInitCreditLimit(Double initCreditLimit) {
		this.initCreditLimit = initCreditLimit;
	}
	@Column(name="pre_credit_limit")
	public Double getPreCreditLimit() {
		return preCreditLimit;
	}
	public void setPreCreditLimit(Double preCreditLimit) {
		this.preCreditLimit = preCreditLimit;
	}
	@Column(name="current_credit_limit")
	public Double getCurrentCreditLimit() {
		return currentCreditLimit;
	}
	public void setCurrentCreditLimit(Double currentCreditLimit) {
		this.currentCreditLimit = currentCreditLimit;
	}
	@Temporal(TemporalType.TIMESTAMP) 
	@Column(name="modify_limit_time")	
	public Date getModifyLimitTime() {
		return modifyLimitTime;
	}
	public void setModifyLimitTime(Date modifyLimitTime) {
		this.modifyLimitTime = modifyLimitTime;
	}
	@Column(name="modify_limit_staffid")
	public Long getModifyLimitStaffId() {
		return modifyLimitStaffId;
	}
	public void setModifyLimitStaffId(Long modifyLimitStaffId) {
		this.modifyLimitStaffId = modifyLimitStaffId;
	}
	
}
